﻿<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPageContent.master" AutoEventWireup="false"
    CodeFile="Voucher.aspx.vb" Inherits="Voucher" %>
<%@ Register Src="~/UserControls/DDL.ascx" TagName="DoubleFilteredDropDownList"
    TagPrefix="uc1" %>
<%@ Register Src="~/UserControls/OneFilteredDropDownList.ascx" TagName="OneFilteredDropDownList"
    TagPrefix="uc2" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register TagPrefix="sds" Namespace="Telerik.Web.SessionDS" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link href="Design/EasyAccounting/Buttons.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .viewWrap
        {
            padding: 15px;
            background: #2291b5 0 0 url(Img/bluegradient.gif) repeat-x;
        }
        
        .contactWrap
        {
            padding: 10px 15px 15px 15px;
            background: #fff;
            color: #333;
        }
        
        .contactWrap td
        {
            padding: 0 20px 0 0;
        }
        
        .contactWrap td td
        {
            padding: 3px 20px 3px 0;
        }
        
        .contactWrap img
        {
            border: 1px solid #05679d;
        }
  
    </style>
    <script type="text/javascript">

        function getOuterHTML(obj) {
            if (typeof (obj.outerHTML) == "undefined") {
                var divWrapper = document.createElement("div");
                var copyOb = obj.cloneNode(true);
                divWrapper.appendChild(copyOb);
                return divWrapper.innerHTML
            }
            else
                return obj.outerHTML;
        }

        function PrintRadGrid() {
            var previewWnd = window.open('about:blank', '', '', false);
            var sh = '<%= ClientScript.GetWebResourceUrl(rgVoucher.GetType(),String.Format("Telerik.Web.UI.Skins.{0}.Grid.{0}.css",rgVoucher.Skin)) %>';
            var shBase = '<%= ClientScript.GetWebResourceUrl(rgVoucher.GetType(),"Telerik.Web.UI.Skins.Grid.css") %>';
            var styleStr = "<html><head><link href = '" + sh + "' rel='stylesheet' type='text/css'></link>";
            styleStr += "<link href = '" + shBase + "' rel='stylesheet' type='text/css'></link></head>";
            var htmlcontent = styleStr + "<body>" + getOuterHTML($find('<%= rgVoucher.ClientID %>').get_element()) + "</body></html>";
            previewWnd.document.open();
            previewWnd.document.write(htmlcontent);
            previewWnd.document.close();
            previewWnd.print();

            if (!$telerik.isChrome) {
                previewWnd.close();
            }
        }
        


    </script>
</asp:Content>
<asp:Content ID="Header" ContentPlaceHolderID="HeaderPlaceHolder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rgVoucherLines">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgVoucherLines" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="rgVoucher">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgVoucher" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="pnlVoucher" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnCancel">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="pnlVoucher" />
                    <telerik:AjaxUpdatedControl ControlID="rgVoucher" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnSave">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
                    <telerik:AjaxUpdatedControl ControlID="pnlVoucher" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="rgVoucher" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Office2010Blue"
        Transparency="20">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
    </telerik:RadWindowManager>
    <br />
    <br />
    <telerik:RadGrid ID="rgVoucher" DataSourceID="odsVoucher"  CellSpacing="0"  runat="server"
        AutoGenerateColumns="False" AllowSorting="True"
        Skin="Office2010Blue" AllowPaging="True" GridLines="None" ShowGroupPanel="True"
        OnItemCreated="rgVoucher_ItemCreated" 
        OnItemCommand="rgVoucher_ItemCommand" AllowFilteringByColumn="True">
        <PagerStyle Mode="NumericPages"></PagerStyle>
        <MasterTableView DataSourceID="odsVoucher" CommandItemDisplay="TopAndBottom" DataKeyNames="ID"
            Width="880px" AllowMultiColumnSorting="True" GroupLoadMode="Server" NoMasterRecordsText="<%$ Resources:MainGrid , NoMasterRecordsText %>"
            NoDetailRecordsText="<%$ Resources:MainGrid , NoMasterRecordsText %>" AllowFilteringByColumn="true">
            <CommandItemTemplate>
                <table >
                    <tr>
                        <td>
                            <asp:ImageButton ID="ibtnInitInsert" CausesValidation="false" CommandName="Add" runat="server"
                                ImageUrl="Design/images/Grid/AddRecord.gif" />
                            <asp:LinkButton ID="lbtnInitInsert" CausesValidation="false" runat="server" Font-Size="14px"
                                Text="<%$ Resources:MainGrid , AddNew %>" Visible="true" CommandName="Add" />&nbsp;&nbsp;&nbsp;&nbsp;
                            <asp:ImageButton ID="ibtnEditSelected" CausesValidation="false" CommandName="Edit"
                                runat="server" ImageUrl="Design/images/Grid/Edit.gif" />
                            <asp:LinkButton ID="lbtnEditSelected" CausesValidation="false" runat="server" Font-Size="Medium"
                                Text="<%$ Resources:MainGrid , EditSelected %>" Visible="true" CommandName="Edit" />&nbsp;&nbsp;&nbsp;&nbsp;
                            <asp:ImageButton ID="ibtnDeleteSelected" CausesValidation="false" CommandName="DeleteSelected"
                                OnClientClick="<%$ Resources:MainGrid , OnClientClickDelete %>" runat="server"
                                ImageUrl="Design/images/Grid/Delete.gif" />
                            <asp:LinkButton ID="lbtnDeleteSelected" Font-Size="Medium" CausesValidation="false"
                                OnClientClick="<%$ Resources:MainGrid , OnClientClickDelete %>" runat="server"
                                Text="<%$ Resources:MainGrid , DeleteSelected %>" CommandName="DeleteSelected" />&nbsp;&nbsp;&nbsp;&nbsp;
                            <asp:ImageButton ID="ibtnRebindGrid" CausesValidation="false" CommandName="RebindGrid"
                                runat="server" ImageUrl="Design/images/Grid/Refresh.gif" />
                            <asp:LinkButton ID="lbtnRebindGrid" Font-Size="Medium" CausesValidation="false" runat="server"
                                Text="<%$ Resources:MainGrid , Refresh %>" CommandName="RebindGrid" />
                       
                            <asp:Literal ID="ltrArabicSpace" meta:ResourceKey="ArabicSpace" runat="server">
                     </asp:Literal>
                            <asp:ImageButton ID="ibtnExport" CausesValidation="false" CommandName="ExportColumn"
                                OnClientClick="<%$ Resources:MainGrid , ContinueConfirm %>" runat="server" ImageUrl="Design/images/Grid/export.png" />
                            <asp:LinkButton Font-Italic="true" ForeColor="Red" ID="lbtnExport" Font-Size="Medium"
                                CausesValidation="false" OnClientClick="<%$ Resources:MainGrid , ContinueConfirm %>"
                                runat="server" Text="<%$ Resources:MainGrid , ExportSelected %>" CommandName="ExportColumn" />&nbsp;&nbsp;&nbsp;&nbsp;
                        </td>
                    </tr>
                </table>
            </CommandItemTemplate>
            <NestedViewTemplate>
                <asp:Panel runat="server" ID="InnerContainer" CssClass="viewWrap" Visible="false">
                    <telerik:RadTabStrip runat="server" Skin="Vista" ID="TabStip1" MultiPageID="Multipage1"
                        SelectedIndex="0">
                        <Tabs>
                            <telerik:RadTab runat="server" meta:ResourceKey="LinesTab" PageViewID="PageView1">
                            </telerik:RadTab>
                            <telerik:RadTab runat="server" meta:ResourceKey="AttachmentsTab" PageViewID="PageView2">
                            </telerik:RadTab>
                        </Tabs>
                    </telerik:RadTabStrip>
                    <telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="0" RenderSelectedPageOnly="false">
                        <telerik:RadPageView runat="server" ID="PageView1" Width="800px">
                            <telerik:RadGrid runat="server" ID="rgLines" OnItemDataBound="rgLines_ItemDataBound"
                                DataSourceID="odsVoucherLines" ShowFooter="true" AllowSorting="true" EnableLinqExpressions="false"
                                Width="800px">
                                <MasterTableView ShowHeader="true" Width="800px" AutoGenerateColumns="False" AllowPaging="true"
                                    DataKeyNames="ID" PageSize="7" HierarchyLoadMode="ServerOnDemand">
                                    <Columns>
                                        <telerik:GridBoundColumn DataField="ID" HeaderText="ID" ReadOnly="True" SortExpression="ID"
                                            UniqueName="ID" Visible="false">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="TransYear" meta:ResourceKey="gbcYear" SortExpression="TransYear"
                                            UniqueName="TransYear">
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="80px" />
                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="80px" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="PayOrderNo" meta:ResourceKey="gbcPayOrderNo"
                                            SortExpression="PayOrderNo" UniqueName="PayOrderNo">
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="150px" />
                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="150px" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="ProgramNo" meta:ResourceKey="gbcProgram" SortExpression="ProgramNo"
                                            UniqueName="ProgramNo">
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="AccountNo" meta:ResourceKey="gbcAccount_Num"
                                            SortExpression="AccountNo" UniqueName="AccountNo">
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="Account_Name" meta:ResourceKey="gbcAccount_Name"
                                            SortExpression="Account_Name" UniqueName="Account_Name" Visible="true">
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="Debit" meta:ResourceKey="gbcDebit" ReadOnly="True"
                                            SortExpression="Debit" UniqueName="Debit" Visible="true" Aggregate="Sum" DataFormatString="{0:###,###.##}">
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                            <FooterStyle BackColor="Green" ForeColor="White" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="Credit" meta:ResourceKey="gbcCredit" ReadOnly="True"
                                            SortExpression="Credit" UniqueName="Credit" Visible="true" Aggregate="Sum"
                                            DataFormatString="{0:###,###.##}">
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                            <FooterStyle BackColor="Green" ForeColor="White" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridDropDownColumn DataField="CostCenter" ListTextField="<%$ Resources:SystemResource, rcbLookup %>"
                                            ReadOnly="True" SortExpression="CostCenter" UniqueName="CostCenter" Visible="true"
                                            DataSourceID="odsCostCenter" ListValueField="MINOR">
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </telerik:GridDropDownColumn>
                                        <telerik:GridBoundColumn DataField="Remarks" meta:ResourceKey="gbcRemarks" ReadOnly="True"
                                            SortExpression="Remarks" UniqueName="Remarks" Visible="true">
                                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        </telerik:GridBoundColumn>
                                    </Columns>
                                </MasterTableView>
                            </telerik:RadGrid>
                            
                        </telerik:RadPageView>
                        <telerik:RadPageView runat="server" ID="PageView2" Width="800px">
                            <table cellpadding="0" cellspacing="0">
                                <tr>
                                    <td>
                                        <telerik:RadGrid runat="server" ID="rgAttachments" Width="800px" DataSourceID="odsAttachments"
                                            ShowFooter="true" AllowSorting="true" EnableLinqExpressions="false" AllowAutomaticDeletes="True"
                                            OnItemDataBound="rgAttachments_ItemDataBound">
                                            <MasterTableView ShowHeader="true" AutoGenerateColumns="False" AllowPaging="true"
                                                DataKeyNames="FileID" PageSize="7" HierarchyLoadMode="ServerOnDemand" Width="800px">
                                                <Columns>
                                                    <telerik:GridBoundColumn DataField="FileID" HeaderText="FileID" ReadOnly="True" SortExpression="FileID"
                                                        UniqueName="FileID" Visible="false">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="Voucher_IDN" SortExpression="Voucher_IDN" UniqueName="Voucher_IDN"
                                                        Visible="false">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridHyperLinkColumn Text="Open" UniqueName="OpenAttachment" Visible="true">
                                                    </telerik:GridHyperLinkColumn>
                                                    <telerik:GridBoundColumn DataField="Name" meta:ResourceKey="gbcName" SortExpression="Name"
                                                        UniqueName="Name">
                                                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="ContentType" meta:ResourceKey="gbcContentType"
                                                        SortExpression="ContentType" UniqueName="ContentType">
                                                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridButtonColumn UniqueName="DeleteColumn" ConfirmText="<%$ Resources:MainGrid , ConfirmDelete %>"
                                                        ConfirmTitle="Confirm" ButtonType="ImageButton" CommandName="Delete">
                                                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                                    </telerik:GridButtonColumn>
                                                </Columns>
                                            </MasterTableView>
                                        </telerik:RadGrid>
                                        <asp:ObjectDataSource ID="odsAttachments" runat="server" SelectMethod="QueryDatabase"
                                            TypeName="DBtblFilesSP" DeleteMethod="QueryDatabase">
                                            <SelectParameters>
                                                <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
                                                <asp:Parameter DefaultValue="RtvFile" Name="Operation" Type="String" />
                                                <asp:Parameter Name="FileID" Type="String" />
                                                <asp:Parameter Name="Voucher_IDC" Type="String" />
                                                
                                                <asp:ControlParameter ControlID="hdnVoucherID" Name="Voucher_IDN" PropertyName="Value" Type="String" />
                                                <asp:Parameter Name="Name" Type="String" />
                                                <asp:Parameter Name="ContentType" Type="String" />
                                                <asp:Parameter Name="Data" Type="String" />
                                            </SelectParameters>
                                            <DeleteParameters>
                                                <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
                                                <asp:Parameter DefaultValue="DeleteFile" Name="Operation" Type="String" />
                                                <asp:Parameter Name="FileID" Type="String" />
                                                <asp:Parameter Name="Voucher_IDC" Type="String" />
                                                
                                                <asp:ControlParameter ControlID="hdnVoucherID" Name="Voucher_IDN" PropertyName="Value" Type="String" />
                                                <asp:Parameter Name="Name" Type="String" />
                                                <asp:Parameter Name="ContentType" Type="String" />
                                                <asp:Parameter Name="Data" Type="String" />
                                            </DeleteParameters>
                                        </asp:ObjectDataSource>
                                    </td>
                                </tr>
                            </table>
                        </telerik:RadPageView>
                    </telerik:RadMultiPage>
                </asp:Panel>
            </NestedViewTemplate>
            <Columns>
                <telerik:GridBoundColumn SortExpression="ID" Visible="false" HeaderButtonType="TextButton"
                    DataField="ID" UniqueName="ID">
                </telerik:GridBoundColumn>
                <telerik:GridDropDownColumn DataField="VoucherType" ListTextField="<%$ Resources:SystemResource, rcbLookup %>"
                    ReadOnly="True" SortExpression="VoucherType" UniqueName="VoucherType" Visible="true"
                    DataSourceID="odsVoucherType" ListValueField="MINOR" meta:ResourceKey="gbcVoucherType">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <FilterTemplate>
                        <center>
                            <telerik:RadComboBox ID="rcbFilterVoucherType" DataSourceID="odsVoucherType" DataTextField="<%$ Resources:SystemResource, rcbLookup %>"
                                Width="90px" DropDownWidth="120px" DataValueField="MINOR" Height="200px" AppendDataBoundItems="true"
                                SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("VoucherType").CurrentFilterValue %>'
                                runat="server" OnClientSelectedIndexChanged="VoucherTypeIndexChanged">
                                <Items>
                                    <telerik:RadComboBoxItem Text="All" />
                                </Items>
                            </telerik:RadComboBox>
                        </center>
                        <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
                            <script type="text/javascript">
                                function VoucherTypeIndexChanged(sender, args) {
                                    var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
                                    tableView.filter("VoucherType", args.get_item().get_value(), "EqualTo");
                                }
                            </script>
                        </telerik:RadScriptBlock>
                    </FilterTemplate>
                </telerik:GridDropDownColumn>
                <telerik:GridBoundColumn SortExpression="Year" HeaderButtonType="TextButton" FilterControlWidth="50px"
                    CurrentFilterFunction="EqualTo" DataField="Year" UniqueName="Year" meta:ResourceKey="gbcYear"
                    ShowFilterIcon="false" AutoPostBackOnFilter="true">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn SortExpression="Serial" HeaderButtonType="TextButton" FilterControlWidth="50px"
                    CurrentFilterFunction="Contains" DataField="Serial" UniqueName="Serial" meta:ResourceKey="gbcSerial"
                    ShowFilterIcon="false" AutoPostBackOnFilter="true">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn SortExpression="VoucherNo" HeaderButtonType="TextButton" FilterControlWidth="50px"
                    CurrentFilterFunction="Contains" DataField="VoucherNo" UniqueName="VoucherNo" meta:ResourceKey="gbcVoucherNo"
                    ShowFilterIcon="false" AutoPostBackOnFilter="true">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </telerik:GridBoundColumn>
                <telerik:GridDateTimeColumn PickerType="DatePicker" SortExpression="VoucherDate"
                    DataFormatString="{0:MM/dd/yyyy}" ShowFilterIcon="false" AutoPostBackOnFilter="true"
                    HeaderButtonType="TextButton" DataField="VoucherDate" UniqueName="VoucherDate"
                    meta:ResourceKey="gbcVoucherDate" FilterControlWidth="60px">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </telerik:GridDateTimeColumn>
                <telerik:GridBoundColumn DataField="Debit" meta:ResourceKey="gbcDebit" ReadOnly="True"
                    SortExpression="Debit" CurrentFilterFunction="Contains" FilterControlWidth="30px"
                    UniqueName="Debit" Visible="true" DataFormatString="{0:###,###.##}" Aggregate="Sum"
                    FooterStyle-HorizontalAlign="Center">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="70px" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="70px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Credit" meta:ResourceKey="gbcCredit" ReadOnly="True"
                    SortExpression="Credit" CurrentFilterFunction="Contains" FilterControlWidth="30px"
                    UniqueName="Credit" Visible="true" DataFormatString="{0:###,###.##}" Aggregate="Sum"
                    FooterStyle-HorizontalAlign="Center">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
                </telerik:GridBoundColumn>
                <telerik:GridDropDownColumn DataField="CostCenter" ListTextField="<%$ Resources:SystemResource, rcbLookup %>"
                    ReadOnly="True" SortExpression="CostCenter" UniqueName="CostCenter" Visible="true"
                    DataSourceID="odsCostCenter" ListValueField="MINOR" meta:ResourceKey="gbcCostCenter">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <FilterTemplate>
                        <center>
                            <telerik:RadComboBox ID="rcbFilterCostCenter" DataSourceID="odsCostCenter" DataTextField="<%$ Resources:SystemResource, rcbLookup %>"
                                Width="90px" DataValueField="MINOR" Height="200px" AppendDataBoundItems="true"
                                SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("CostCenter").CurrentFilterValue %>'
                                runat="server" OnClientSelectedIndexChanged="CostCenterIndexChanged">
                                <Items>
                                    <telerik:RadComboBoxItem Text="All" />
                                </Items>
                            </telerik:RadComboBox>
                        </center>
                        <telerik:RadScriptBlock ID="RadScriptBlock3" runat="server">
                            <script type="text/javascript">
                                function CostCenterIndexChanged(sender, args) {
                                    var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
                                    tableView.filter("CostCenter", args.get_item().get_value(), "EqualTo");
                                }
                            </script>
                        </telerik:RadScriptBlock>
                    </FilterTemplate>
                </telerik:GridDropDownColumn>
                <telerik:GridDropDownColumn DataField="MainCostCenter" ListTextField="<%$ Resources:SystemResource, rcbLookup %>"
                    ReadOnly="True" SortExpression="CostCenter" UniqueName="MainCostCenter" Visible="true"
                    DataSourceID="odsMainCostCenter" ListValueField="MINOR" meta:ResourceKey="gbcMainCostCenter">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <FilterTemplate>
                        <center>
                            <telerik:RadComboBox ID="rcbFilterMainCostCenter" DataSourceID="odsMainCostCenter"
                                DataTextField="<%$ Resources:SystemResource, rcbLookup %>" Width="90px" DataValueField="MINOR"
                                Height="200px" AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("MainCostCenter").CurrentFilterValue %>'
                                runat="server" OnClientSelectedIndexChanged="MainCostCenterIndexChanged">
                                <Items>
                                    <telerik:RadComboBoxItem Text="All" />
                                </Items>
                            </telerik:RadComboBox>
                        </center>
                        <telerik:RadScriptBlock ID="RadScriptBlock4" runat="server">
                            <script type="text/javascript">
                                function MainCostCenterIndexChanged(sender, args) {
                                    var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
                                    tableView.filter("MainCostCenter", args.get_item().get_value(), "EqualTo");
                                }
                            </script>
                        </telerik:RadScriptBlock>
                    </FilterTemplate>
                </telerik:GridDropDownColumn>
                <telerik:GridBoundColumn DataField="Remarks" meta:ResourceKey="gbcMainRemarks" SortExpression="Remarks"
                    ShowFilterIcon="false" UniqueName="Remarks" Visible="true" CurrentFilterFunction="Contains"
                    FilterControlWidth="60px" AutoPostBackOnFilter="true">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </telerik:GridBoundColumn>
                <telerik:GridHyperLinkColumn DataTextField="RecordStatus" Visible="false" SortExpression="RecordStatus"
                    UniqueName="RecordStatus">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </telerik:GridHyperLinkColumn>
            </Columns>
        </MasterTableView>
        <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true">
        </ExportSettings>
        <GroupingSettings CaseSensitive="false" />
        <ClientSettings EnablePostBackOnRowClick="true">
            <Selecting AllowRowSelect="True" />
        </ClientSettings>
    </telerik:RadGrid>
    <asp:Panel ID="pnlVoucher"  Visible="false" runat="server">
        <table  style="table-layout: fixed; ">
            <tr>
                <td >
                    <asp:Label ID="lblYear" runat="server" meta:ResourceKey="lblYear"></asp:Label>
                </td>
                <td  >
                    <telerik:RadNumericTextBox ID="rtbYear" runat="server" MaxLength="4"
                        MaxValue="2200" IncrementSettings-InterceptArrowKeys="true" IncrementSettings-InterceptMouseWheel="true">
                        <NumberFormat DecimalDigits="0" GroupSizes="4" />
                    </telerik:RadNumericTextBox>
                  
                </td>
                <td >
                    <asp:Label ID="lblManType" runat="server" SkinID="Mandetory" Text="<%$ Resources:Controls, RequiredValidationText %>"></asp:Label>
                    <asp:Label ID="lblVoucherType" runat="server" meta:ResourceKey="lblVoucherType"></asp:Label>
                </td>
                <td >
                    <uc2:OneFilteredDropDownList ID="rcbType" runat="server" DataSourceId="odsVoucherType"
                        DataValueField="MINOR" IsRequired="false" DataTextField="<%$ Resources:SystemResource, rcbLookup %>"
                        DefaultChoosedItem="ChooseOne" />
                    <asp:Label ID="Label2" runat="server" Visible="false" meta:ResourceKey="lblTypeMissing"
                        SkinID="Mandetory"></asp:Label>
            
                </td>
            </tr>
            <tr>
                <td >
                    <asp:Label ID="lblManrtbNumber" runat="server" SkinID="Mandetory" Text="<%$ Resources:Controls, RequiredValidationText %>"></asp:Label>
                    <asp:Label ID="lblNumber" runat="server" meta:ResourceKey="lblNumber"></asp:Label>
                </td>
                <td  >
                    <telerik:RadTextBox ID="rtbVoucherNo" runat="server" SkinID="rtbSkin"
                        ValidationGroup="valVoucher">
                    </telerik:RadTextBox>
                    <asp:RequiredFieldValidator ID="rfvrtbNumber" runat="server" ControlToValidate="rtbVoucherNo"
                        ErrorMessage="<%$ Resources:Controls, ErrorMessage %>" ValidationGroup="valVoucher"></asp:RequiredFieldValidator>
                  
                </td>
                <td >
                    <asp:Label ID="lblManrdpDate" runat="server" SkinID="Mandetory" Text="<%$ Resources:Controls, RequiredValidationText %>"></asp:Label>
                    <asp:Label ID="lblDate" runat="server" meta:ResourceKey="lblDate"></asp:Label>
                </td>
                <td >
                    <telerik:RadDatePicker runat="server" Width="170px" ID="rdpDate" Culture="English (United States)"
                        ShowPopupOnFocus="true">
                        <DateInput ID="DateInput1" DateFormat="dd/MM/yyyy" runat="server">
                        </DateInput></telerik:RadDatePicker>
                    <asp:RequiredFieldValidator ID="rfvrdpDate" runat="server" ControlToValidate="rdpDate"
                        ErrorMessage="<%$ Resources:Controls, ErrorMessage %>" ValidationGroup="valVoucher"></asp:RequiredFieldValidator>
                    
                </td>
            </tr>
            <tr>
                <td >
                    <asp:Label ID="lblCostCenter" runat="server" meta:ResourceKey="lblCostCenter"></asp:Label>
                </td>
                <td  >
                    <uc2:OneFilteredDropDownList ID="rcbCostCenter" runat="server" DataSourceId="odsCostCenter"
                        DataValueField="MINOR" IsRequired="false" DataTextField="<%$ Resources:SystemResource, rcbLookup %>"
                        DefaultChoosedItem="ChooseOne" />
                    
                </td>
                <td >
                    <asp:Label ID="lblMainCostCenter" runat="server" meta:ResourceKey="lblMainCostCenter"></asp:Label>
                </td>
                <td >
                    <uc2:OneFilteredDropDownList ID="rcbMainCostCenter" runat="server" DataSourceId="odsMainCostCenter"
                        DataValueField="MINOR" IsRequired="false" DataTextField="<%$ Resources:SystemResource, rcbLookup %>"
                        DefaultChoosedItem="ChooseOne" />
                   
                </td>
            </tr>
            <tr>
                <td  colspan="4">
                    <asp:Label ID="lblRemarks" runat="server" meta:ResourceKey="lblMainRemarks"></asp:Label>
                    &nbsp;&nbsp;
                    <telerik:RadTextBox ID="rtbRemarks" runat="server" Width="250px" Height="70px" TextMode="MultiLine">
                    </telerik:RadTextBox>
                </td>
            </tr>
            <tr>
                <td colspan="4">
                    <!------------------------------------------------ Details ---------------------------------------------------->
                    <telerik:RadGrid ID="rgVoucherLines" runat="server" GridLines="None" DataSourceID="sdsVoucher"
                        AllowAutomaticDeletes="True" AllowAutomaticInserts="True" ShowFooter="True"
                        AllowAutomaticUpdates="True" SkinID="rgSkin" AllowPaging="True" AutoGenerateColumns="False" GroupPanel-Text="<%$ Resources:MainGrid ,GroupPanelText %>"
                        CellSpacing="0">
                        <MasterTableView Width="100%" Caption="<%$ Resources:MainGrid , LinesCaption %>"
                            CommandItemDisplay="TopAndBottom" DataKeyNames="ID" TableLayout="Fixed" HorizontalAlign="NotSet"
                            DataSourceID="sdsVoucher" NoMasterRecordsText="<%$ Resources:MainGrid , NoMasterRecordsText %>">
                            <CommandItemTemplate>
                                <table >
                                    <tr>
                                        <td>
                                            <asp:ImageButton ID="ibtnInitInsert" CommandName="InitInsert" runat="server" ImageUrl="Design/images/Grid/AddRecord.gif" />
                                            <asp:LinkButton ID="lbtnInitInsert" runat="server" Font-Size="14px" Text="<%$ Resources:MainGrid , AddNew %>"
                                                CommandName="InitInsert" Visible="true" />&nbsp;&nbsp;&nbsp;&nbsp;
                                            <asp:ImageButton ID="ibtnEditSelected" CommandName="EditSelected" runat="server"
                                                ImageUrl="Design/images/Grid/Edit.gif" />
                                            <asp:LinkButton ID="lbtnEditSelected" runat="server" Font-Size="14px" Text="<%$ Resources:MainGrid , EditSelected %>"
                                                CommandName="EditSelected" Visible="true" />&nbsp;&nbsp;&nbsp;&nbsp;
                                            <asp:ImageButton ID="ibtnDeleteSelected" CommandName="DeleteSelected" runat="server"
                                                ImageUrl="Design/images/Grid/Delete.gif" />
                                            <asp:LinkButton ID="lbtnDeleteSelected" Font-Size="14px" OnClientClick="<%$ Resources:MainGrid , OnClientClickDelete %>"
                                                runat="server" Text="<%$ Resources:MainGrid , DeleteSelected %>" CommandName="DeleteSelected" />&nbsp;&nbsp;&nbsp;&nbsp;
                                            <asp:ImageButton ID="ibtnRebindGrid" CommandName="RebindGrid" runat="server" ImageUrl="Design/images/Grid/Refresh.gif" />
                                            <asp:LinkButton ID="lbtnRebindGrid" Font-Size="14px" runat="server" Text="<%$ Resources:MainGrid , Refresh %>"
                                                CommandName="RebindGrid" />
                                        </td>
                                    </tr>
                                </table>
                            </CommandItemTemplate>
                            <Columns>
                                <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="ImageButton">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                </telerik:GridEditCommandColumn>
                                <telerik:GridBoundColumn DataField="ID" HeaderText="ID" ReadOnly="True" SortExpression="ID"
                                    UniqueName="ID" Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Year" meta:ResourceKey="gbcYear" SortExpression="Year"
                                    UniqueName="Year">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="PayOrderNo" meta:ResourceKey="gbcPayOrderNo"
                                    SortExpression="PayOrderNo" UniqueName="PayOrderNo">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="150px" />
                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="150px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ProgramNo" meta:ResourceKey="gbcProgram" SortExpression="ProgramNo"
                                    UniqueName="ProgramNo">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                </telerik:GridBoundColumn>
                                   <telerik:GridDropDownColumn DataField="AccountNo" DataSourceID="odsAccount" meta:ResourceKey="gbcAccount_Num"
                                ListTextField="AccountNo" ListValueField="AccountNo" UniqueName="AccountNo" EnableEmptyListItem="True">
                                <HeaderStyle Width="50px" />
                                <ItemStyle Width="50px" />
                            </telerik:GridDropDownColumn>
                            <telerik:GridDropDownColumn DataField="AccountNo" DataSourceID="odsAccount" meta:ResourceKey="gbcAccount_Name"
                                ListTextField="AccountNameAr" ListValueField="AccountNo" UniqueName="AccountNo" EnableEmptyListItem="True">
                                <HeaderStyle Width="100px" />
                                <ItemStyle Width="100px" />
                            </telerik:GridDropDownColumn>
                           <telerik:GridBoundColumn DataField="Debit" meta:ResourceKey="gbcDebit" ReadOnly="True"
                                    SortExpression="Debit" UniqueName="Debit" Visible="true" Aggregate="Sum" DataFormatString="{0:###,###.##}">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <FooterStyle BackColor="Green" ForeColor="White" />
                                </telerik:GridBoundColumn>
                           <telerik:GridBoundColumn DataField="Credit" meta:ResourceKey="gbcCredit" ReadOnly="True"
                                    SortExpression="Credit" UniqueName="Credit" Visible="true" Aggregate="Sum"
                                    DataFormatString="{0:###,###.##}">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <FooterStyle BackColor="Green" ForeColor="White" />
                                </telerik:GridBoundColumn>
                                <telerik:GridDropDownColumn DataField="CostCenter" meta:ResourceKey="gbcCostCenter"
                                    ListTextField="<%$ Resources:SystemResource, rcbLookup %>" ReadOnly="True" SortExpression="CostCenter"
                                    UniqueName="CostCenter" Visible="true" DataSourceID="odsCostCenter" ListValueField="MINOR"
                                    EmptyListItemValue="-1">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                </telerik:GridDropDownColumn>
                                <telerik:GridDropDownColumn DataField="CostCenter" DataSourceID="odsCostCenter" ListTextField="MINOR"
                                    ListValueField="MINOR" UniqueName="CostCenter_ID" Visible="false">
                                </telerik:GridDropDownColumn>
                                <telerik:GridBoundColumn DataField="Remarks" meta:ResourceKey="gbcRemarks" ReadOnly="True"
                                    SortExpression="Remarks" UniqueName="Remarks" Visible="true">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                </telerik:GridBoundColumn>
                                <telerik:GridHyperLinkColumn DataTextField="RecordStatus" Visible="false" SortExpression="RecordStatus"
                                    UniqueName="RecordStatus">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                </telerik:GridHyperLinkColumn>
                                <telerik:GridButtonColumn UniqueName="DeleteColumn" ConfirmText="<%$ Resources:MainGrid , ConfirmDelete %>"
                                    ConfirmTitle="Confirm" ButtonType="ImageButton" CommandName="Delete">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                </telerik:GridButtonColumn>
                                <telerik:GridButtonColumn UniqueName="ExportColumn" Visible="false" meta:ResourceKey="gbcExport"
                                    ConfirmText="<%$ Resources:MainGrid , Continue %>" ConfirmTitle="Confirm" ButtonType="LinkButton"
                                    CommandName="ExportColumn">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                </telerik:GridButtonColumn>
                                <telerik:GridButtonColumn UniqueName="ReturnColumn" Visible="false" meta:ResourceKey="gbcReturn"
                                    ConfirmText="<%$ Resources:MainGrid , Continue %>" ConfirmTitle="Confirm" ButtonType="LinkButton"
                                    CommandName="ReturnColumn">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                </telerik:GridButtonColumn>
                            </Columns>
                            <EditFormSettings ColumnNumber="2" EditFormType="Template" CaptionDataField="ID"
                                CaptionFormatString="Edit properties of {0}" InsertCaption="New Line">
                                <FormTableItemStyle Wrap="False"></FormTableItemStyle>
                                <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>
                                <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White"
                                    Width="100%" />
                                <FormTableStyle CellSpacing="0" CellPadding="2" Height="110px" BackColor="White" />
                                <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
                                <EditColumn ButtonType="ImageButton" InsertText="Insert User" UpdateText="Update record"
                                    UniqueName="EditCommandColumn1" CancelText="Cancel edit">
                                </EditColumn>
                                <FormTableButtonRowStyle HorizontalAlign="Left" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>
                                <FormTemplate>
                                    <table id="Table2" cellspacing="2" cellpadding="1" border="0" rules="none">
                                        <tr style="margin-bottom: 40px">
                                            <td>
                                                <asp:Label ID="lblNewLine" Font-Bold="true" Font-Italic="true" runat="server" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "New Line", "Update Line") %>'
                                                    SkinID="KeyLabel"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td >
                                                <asp:Label ID="lblYear" SkinID="KeyLabel" runat="server" meta:ResourceKey="lblYear"></asp:Label>
                                            </td>
                                            <td  >
                                                <telerik:RadNumericTextBox ID="rtbYear" runat="server" Width="200px" MaxLength="4"
                                                    MaxValue="2200" IncrementSettings-InterceptArrowKeys="true" IncrementSettings-InterceptMouseWheel="true"
                                                    Text='<%# Bind("Year") %>'>
                                                    <NumberFormat DecimalDigits="0" GroupSizes="4" />
                                                </telerik:RadNumericTextBox>
                                            </td>
                                            <td>
                                            </td>
                                            <td>
                                                <asp:Label ID="lblPayOrderNo" runat="server" meta:ResourceKey="lblPayOrderNo" SkinID="KeyLabel"></asp:Label>
                                                &nbsp;&nbsp;
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="rtbPayOrderNo" runat="server" Width="200px" Text='<%# Bind("PayOrderNo") %>'>
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:Label ID="lblManrntbDebit" runat="server" SkinID="Mandetory" Text="<%$ Resources:Controls, RequiredValidationText %>"></asp:Label>
                                                <asp:Label ID="lblDebit" runat="server" meta:ResourceKey="lblDebit" SkinID="KeyLabel"></asp:Label>
                                                &nbsp;&nbsp;
                                            </td>
                                            <td>
                                                <telerik:RadNumericTextBox ID="rntbDebit" runat="server" Width="200px" Text='<%# Bind("Debit") %>'
                                                    IncrementSettings-InterceptArrowKeys="true" IncrementSettings-InterceptMouseWheel="true">
                                                    <NumberFormat DecimalDigits="2" />
                                                </telerik:RadNumericTextBox>
                                            </td>
                                            <td style="width: 100px">
                                                <asp:RequiredFieldValidator ID="rfvrntbDebit" runat="server" ControlToValidate="rntbDebit"
                                                    ErrorMessage="<%$ Resources:Controls, ErrorMessage %>" ValidationGroup="valEditMode"></asp:RequiredFieldValidator>
                                            </td>
                                            <td>
                                                <asp:Label ID="lblProgram" runat="server" meta:ResourceKey="lblProgram" SkinID="KeyLabel"></asp:Label>
                                                &nbsp;&nbsp;
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="rtbProgram" Width="200px" runat="server" Text='<%# Bind("ProgramNo") %>'>
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:Label ID="lblManrntbCredit" runat="server" SkinID="Mandetory" Text="<%$ Resources:Controls, RequiredValidationText %>"></asp:Label>
                                                <asp:Label ID="lblCredit" runat="server" meta:ResourceKey="lblCredit" SkinID="KeyLabel"></asp:Label>
                                            </td>
                                            <td>
                                                <telerik:RadNumericTextBox ID="rntbCredit" runat="server" Width="200px" Text='<%# Bind("Credit") %>'
                                                    IncrementSettings-InterceptArrowKeys="true" IncrementSettings-InterceptMouseWheel="true">
                                                    <NumberFormat DecimalDigits="2" />
                                                </telerik:RadNumericTextBox>
                                            </td>
                                            <td style="width: 100px">
                                                <asp:RequiredFieldValidator ID="rfvrntbCredit" runat="server" ControlToValidate="rntbCredit"
                                                    ErrorMessage="<%$ Resources:Controls, ErrorMessage %>" ValidationGroup="valEditMode"></asp:RequiredFieldValidator>
                                            </td>
                                            <td>
                                                <asp:Label ID="lblManrcbAccount" runat="server" SkinID="Mandetory" Text="<%$ Resources:Controls, RequiredValidationText %>"></asp:Label>
                                                <asp:Label ID="lblrcbAccount" runat="server" meta:ResourceKey="lblrcbAccount" SkinID="KeyLabel"></asp:Label>
                                                &nbsp;&nbsp;
                                            </td>
                                            <td>
                                                     <uc1:DoubleFilteredDropDownList ID="WUCAcc" IsRequired="false" runat="server" DataSourceId="odsAccount"
                                                            DataTextField="AccountNameAr" DataValueField="AccountNo" SelectedValue='<%#  Bind( "AccountNo") %>'
                                                            DefaultChoosedItem="ChooseOne" ValidationGroup="valEditMode" />
                                            </td>
                                            <td>
                                               
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:Label ID="lblrcbCostCenter" runat="server" meta:ResourceKey="lblrcbCostCenter"
                                                    SkinID="KeyLabel"></asp:Label>
                                                &nbsp;&nbsp;
                                            </td>
                                            <td>
                                                <uc2:OneFilteredDropDownList ID="rcbCostCenter" runat="server" DataSourceId="odsCostCenter"
                                                    DataValueField="MINOR" IsRequired="false" DataTextField="<%$ Resources:SystemResource, rcbLookup %>"
                                                    DefaultChoosedItem="ChooseOne" SelectedValue='<%# Bind("CostCenter") %>' />
                                            </td>
                                            <td>
                                            </td>
                                            <td>
                                                <asp:Label ID="lblRemarks" runat="server" meta:ResourceKey="lblRemarks" SkinID="KeyLabel"></asp:Label>
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="rtbRemarks" TextMode="MultiLine" Height="20px" runat="server"
                                                    Width="200px" Text='<%# Bind("Remarks") %>'>
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="6"> 
                                                <div style="margin-top: 10px">
                                                    <telerik:RadButton ID="btnInsert" meta:ResourceKey="btnInsert" Visible='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "True", "False") %>'
                                                        runat="server" CommandName="PerformInsert" Icon-PrimaryIconCssClass="rbOk">
                                                    </telerik:RadButton>
                                                    <telerik:RadButton ID="btnUpdate" meta:ResourceKey="btnUpdate" Visible='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "False", "True") %>'
                                                        runat="server" CommandName="Update" CausesValidation="true" ValidationGroup="ValEditMode"
                                                        Icon-PrimaryIconCssClass="rbOk">
                                                    </telerik:RadButton>
                                                    &nbsp;
                                                    <telerik:RadButton ID="btnCancel" meta:ResourceKey="btnCancel" runat="server" CausesValidation="False"
                                                        CommandName="Cancel" Icon-PrimaryIconCssClass="rbCancel">
                                                    </telerik:RadButton>
                                                </div>
                                            </td>
                                        </tr>
                                    </table>
                                </FormTemplate>
                            </EditFormSettings>
                            <CommandItemSettings ExportToPdfText="Export to PDF" />
                            <RowIndicatorColumn>
                                <HeaderStyle Width="20px" />
                            </RowIndicatorColumn>
                            <ExpandCollapseColumn>
                                <HeaderStyle Width="20px" />
                            </ExpandCollapseColumn>
                            <HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                                Font-Underline="False" HorizontalAlign="Center" Wrap="True" />
                        </MasterTableView>
                        <ValidationSettings CommandsToValidate="PerformInsert,Update" ValidationGroup="valEditMode" />
                        <ClientSettings AllowDragToGroup="False">
                            <Scrolling AllowScroll="false" ScrollHeight="400px" />
                            <Selecting AllowRowSelect="True" />
                        </ClientSettings>
                        <FilterMenu EnableTheming="True">
                            <CollapseAnimation Duration="200" Type="OutQuint" />
                        </FilterMenu>
                        <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
                    </telerik:RadGrid>
                    <asp:HiddenField ID="hdnVoucherID" runat="server" />
                </td>
            </tr>
            <tr>
                <td >
                </td>
            </tr>
            <tr>
                <td colspan="4">
                    <br />
                    <asp:Label ID="lblFileUpload" runat="server" Font-Size="Medium" Font-Italic="true"
                        meta:ResourceKey="lblFileUpload"></asp:Label>
                    &nbsp;&nbsp;
                    <telerik:RadAsyncUpload runat="server" ID="AsyncUploadVoucher" meta:ResourceKey="RadUpload"
                        AllowedFileExtensions="jpg,jpeg,png,gif,bmp,txt,pdf,doc,docx,xls,xlsx">
                    </telerik:RadAsyncUpload>
                    
                    <asp:Label ID="lblUploadError" runat="server" Visible="false" meta:ResourceKey="lblUploadError"
                        SkinID="Mandetory"></asp:Label>
                </td>
            </tr>
        </table>
        <br />
        <br />
        <br />
        <br />
        <asp:LinkButton ID="btnSave" runat="server" Font-Bold="false" meta:ResourceKey="btnSave"
            Font-Size="Medium" CssClass="menuitem_green" />
        &nbsp;
        <asp:LinkButton ID="btnCancel" runat="server" Font-Bold="false" meta:ResourceKey="btnCancel"
            Font-Size="Medium" CssClass="menuitem_red" />
            </asp:Panel>
   
   <asp:ObjectDataSource ID="odsVoucherLines" runat="server" SelectMethod="QueryDatabase"
                                TypeName="DBVoucherLinesSP" 
        DeleteMethod="QueryDatabase" InsertMethod="QueryDatabase" 
        UpdateMethod="QueryDatabase">
                                <DeleteParameters>
                                    <asp:Parameter Name="QueryType" Type="Object" />
                                    <asp:Parameter Name="Operation" Type="String" />
                                    <asp:Parameter Name="ID" Type="String" />
                                    <asp:Parameter Name="VoucherID" Type="String" />
                                    <asp:Parameter Name="TransYear" Type="String" />
                                    <asp:Parameter Name="PayOrderNo" Type="String" />
                                    <asp:Parameter Name="ProgramNo" Type="String" />
                                    <asp:Parameter Name="AccountNo" Type="String" />
                                    <asp:Parameter Name="CostCenter" Type="String" />
                                    <asp:Parameter Name="Debit" Type="String" />
                                    <asp:Parameter Name="Credit" Type="String" />
                                    <asp:Parameter Name="RecordStatus" Type="String" />
                                    <asp:Parameter Name="LastUpdateBy" Type="String" />
                                    <asp:Parameter Name="LastUpdateDate" Type="String" />
                                    <asp:Parameter Name="Remarks" Type="String" />
                                </DeleteParameters>
                                <InsertParameters>
                                    <asp:Parameter Name="QueryType" Type="Object" />
                                    <asp:Parameter Name="Operation" Type="String" />
                                    <asp:Parameter Name="ID" Type="String" />
                                    <asp:Parameter Name="VoucherID" Type="String" />
                                    <asp:Parameter Name="TransYear" Type="String" />
                                    <asp:Parameter Name="PayOrderNo" Type="String" />
                                    <asp:Parameter Name="ProgramNo" Type="String" />
                                    <asp:Parameter Name="AccountNo" Type="String" />
                                    <asp:Parameter Name="CostCenter" Type="String" />
                                    <asp:Parameter Name="Debit" Type="String" />
                                    <asp:Parameter Name="Credit" Type="String" />
                                    <asp:Parameter Name="RecordStatus" Type="String" />
                                    <asp:Parameter Name="LastUpdateBy" Type="String" />
                                    <asp:Parameter Name="LastUpdateDate" Type="String" />
                                    <asp:Parameter Name="Remarks" Type="String" />
                                </InsertParameters>
                                <SelectParameters>
                                    <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
                                    <asp:Parameter DefaultValue="ShowVoucherLines" Name="Operation" Type="String" />
                                    <asp:Parameter Name="ID" Type="String" />
                                    <asp:ControlParameter ControlID="hdnVoucherID" Name="VoucherID" PropertyName="Value" Type="String" />
                                    <asp:Parameter Name="TransYear" Type="String" />
                                    <asp:Parameter Name="PayOrderNo" Type="String" />
                                    <asp:Parameter Name="ProgramNo" Type="String" />
                                    <asp:Parameter Name="AccountNo" Type="String" />
                                    <asp:Parameter Name="CostCenter" Type="String" />
                                    <asp:Parameter Name="Debit" Type="String" />
                                    <asp:Parameter Name="Credit" Type="String" />
                                    <asp:Parameter Name="RecordStatus" Type="String" />
                                    <asp:Parameter Name="LastUpdateBy" Type="String" />
                                    <asp:Parameter Name="LastUpdateDate" Type="String" />
                                    <asp:Parameter Name="Remarks" Type="String" />
                                </SelectParameters>
                                <UpdateParameters>
                                    <asp:Parameter Name="QueryType" Type="Object" />
                                    <asp:Parameter Name="Operation" Type="String" />
                                    <asp:Parameter Name="ID" Type="String" />
                                    <asp:Parameter Name="VoucherID" Type="String" />
                                    <asp:Parameter Name="TransYear" Type="String" />
                                    <asp:Parameter Name="PayOrderNo" Type="String" />
                                    <asp:Parameter Name="ProgramNo" Type="String" />
                                    <asp:Parameter Name="AccountNo" Type="String" />
                                    <asp:Parameter Name="CostCenter" Type="String" />
                                    <asp:Parameter Name="Debit" Type="String" />
                                    <asp:Parameter Name="Credit" Type="String" />
                                    <asp:Parameter Name="RecordStatus" Type="String" />
                                    <asp:Parameter Name="LastUpdateBy" Type="String" />
                                    <asp:Parameter Name="LastUpdateDate" Type="String" />
                                    <asp:Parameter Name="Remarks" Type="String" />
                                </UpdateParameters>
                            </asp:ObjectDataSource>



    <sds:SessionDataSource ID="sdsVoucher" runat="server" ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>"
        SelectCommand="SELECT [ID], [TransYear], [VoucherID],[PayOrderNo], [ProgramNo], [AccountNo], [Debit], [Credit], [CostCenter], [Remarks], [RecordStatus], [LastUpdateBy], [LastUpdateDate] FROM [VoucherLines] WHERE  VoucherID = @VoucherID"
        DeleteCommand="DELETE FROM [VoucherLines] WHERE [ID] = ?" InsertCommand="INSERT INTO [VoucherLines]([VoucherID],[TransYear] ,[PayOrderNo] ,[ProgramNo] ,[AccountNo] ,[Debit] ,[Credit] ,[CostCenter] ,[Remarks] ,[RecordStatus] ,[LastUpdateBy] ,[LastUpdateDate]) VALUES ( @VoucherID,?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
        UpdateCommand="UPDATE [VoucherLines] SET [VoucherID] = @VoucherID ,[TransYear] = @TransYear  ,[PayOrderNo] = @PayOrderNo ,[ProgramNo] = @ProgramNo ,[AccountNo] = @AccountNo  ,[Debit] = @Debit  ,[Credit] = @Credit      ,[CostCenter] = @CostCenter     ,[Remarks] = @Remarks   ,[RecordStatus] = @RecordStatus   ,[LastUpdateBy] = @LastUpdateBy   ,[LastUpdateDate] = @LastUpdateDate WHERE [VoucherID] = ? ,[TransYear] = ?  ,[PayOrderNo] = ? ,[ProgramNo] = ? ,[AccountNo] = ?  ,[Debit] = ?  ,[Credit] = ?      ,[CostCenter] = ?     ,[Remarks] = ?   ,[RecordStatus] = ?   ,[LastUpdateBy] = ?   ,[LastUpdateDate] = ?"
        PrimaryKeyFields="ID" OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues"
        ClearSessionOnInitialLoad="True" SessionKey="System.Web.UI.Page_sdsVoucher">
        <SelectParameters>
            <asp:ControlParameter ControlID="hdnVoucherID" Name="VoucherID" PropertyName="Value" Type="String" />
        </SelectParameters>
        <UpdateParameters>
            <asp:ControlParameter ControlID="hdnVoucherID" Name="VoucherID" PropertyName="Value" Type="String" />
        </UpdateParameters>
        <InsertParameters>
            <asp:ControlParameter ControlID="hdnVoucherID" Name="VoucherID" PropertyName="Value" Type="String" />
        </InsertParameters>
    </sds:SessionDataSource>
    <asp:ObjectDataSource ID="odsVoucher" runat="server" SelectMethod="QueryDatabase"
        TypeName="DBVoucherSP" DeleteMethod="QueryDatabase" 
        InsertMethod="QueryDatabase" UpdateMethod="QueryDatabase">
        <InsertParameters>
            <asp:Parameter Name="QueryType" Type="Object" />
            <asp:Parameter Name="Operation" Type="String" />
            <asp:Parameter Name="ID" Type="String" />
            <asp:Parameter Name="Year" Type="String" />
            <asp:Parameter Name="VoucherNo" Type="String" />
            <asp:Parameter Name="VoucherDate" Type="String" />
            <asp:Parameter Name="VoucherType" Type="String" />
            <asp:Parameter Name="MainCostCenter" Type="String" />
            <asp:Parameter Name="CostCenter" Type="String" />
            <asp:Parameter Name="RecordStatus" Type="String" />
            <asp:Parameter Name="Remarks" Type="String" />
        </InsertParameters>
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
            <asp:Parameter DefaultValue="RtvVoucher" Name="Operation" Type="String" />
            <asp:Parameter Name="ID" Type="String" />
            <asp:Parameter Name="Year" Type="String" />
            <asp:Parameter Name="VoucherNo" Type="String" />
            <asp:Parameter Name="VoucherDate" Type="String" />
            <asp:Parameter Name="VoucherType" Type="String" />
            <asp:Parameter Name="MainCostCenter" Type="String" />
            <asp:Parameter Name="CostCenter" Type="String" />
            <asp:Parameter Name="RecordStatus" Type="String" />
            <asp:Parameter Name="Remarks" Type="String" />
        </SelectParameters>
        <DeleteParameters>
            <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
            <asp:Parameter DefaultValue="DeleteVoucher" Name="Operation" Type="String" />
            <asp:Parameter Name="ID" Type="String" />
            <asp:Parameter Name="Year" Type="String" />
            <asp:Parameter Name="VoucherNo" Type="String" />
            <asp:Parameter Name="VoucherDate" Type="String" />
            <asp:Parameter Name="VoucherType" Type="String" />
            <asp:Parameter Name="MainCostCenter" Type="String" />
            <asp:Parameter Name="CostCenter" Type="String" />
            <asp:Parameter Name="RecordStatus" Type="String" />
            <asp:Parameter Name="Remarks" Type="String" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="QueryType" Type="Object" />
            <asp:Parameter Name="Operation" Type="String" />
            <asp:Parameter Name="ID" Type="String" />
            <asp:Parameter Name="Year" Type="String" />
            <asp:Parameter Name="VoucherNo" Type="String" />
            <asp:Parameter Name="VoucherDate" Type="String" />
            <asp:Parameter Name="VoucherType" Type="String" />
            <asp:Parameter Name="MainCostCenter" Type="String" />
            <asp:Parameter Name="CostCenter" Type="String" />
            <asp:Parameter Name="RecordStatus" Type="String" />
            <asp:Parameter Name="Remarks" Type="String" />
        </UpdateParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="odsCostCenter" runat="server" SelectMethod="QueryDatabase"
        TypeName="DBlookup_tableSP">
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
            <asp:Parameter DefaultValue="RtvCostCenter" Name="Operation" Type="String" />
            <asp:Parameter Name="MAJOR" Type="String" />
            <asp:Parameter Name="MINOR" Type="String" />
            <asp:Parameter Name="DescriptionAr" Type="String" />
            <asp:Parameter Name="DescriptionEn" Type="String" />
            <asp:Parameter Name="OrderID" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="odsMainCostCenter" runat="server" SelectMethod="QueryDatabase"
        TypeName="DBlookup_tableSP">
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
            <asp:Parameter DefaultValue="RtvMainCostCenter" Name="Operation" Type="String" />
            <asp:Parameter Name="MAJOR" Type="String" />
            <asp:Parameter Name="MINOR" Type="String" />
            <asp:Parameter Name="DescriptionAr" Type="String" />
            <asp:Parameter Name="DescriptionEn" Type="String" />
            <asp:Parameter Name="OrderID" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="odsAccount" runat="server" 
        SelectMethod="QueryDatabase" TypeName="AccountsSP">
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
            <asp:Parameter DefaultValue="rtvAccounts" Name="Operation" Type="String" />
            <asp:Parameter Name="AccountNo" Type="String" />
            <asp:Parameter Name="AccountNameAr" Type="String" />
            <asp:Parameter Name="AccountNameEn" Type="String" />
            <asp:Parameter Name="ParentID" Type="String" />
            <asp:Parameter Name="Remarks" Type="String" />
            <asp:Parameter Name="AccountType" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="odsRecordStatus" runat="server" SelectMethod="QueryDatabase"
        TypeName="DBlookup_tableSP">
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
            <asp:Parameter DefaultValue="RtvRecordStatus" Name="Operation" Type="String" />
            <asp:Parameter Name="MAJOR" Type="String" />
            <asp:Parameter Name="MINOR" Type="String" />
            <asp:Parameter Name="DescriptionAr" Type="String" />
            <asp:Parameter Name="DescriptionEn" Type="String" />
            <asp:Parameter Name="OrderID" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="odsVoucherType" runat="server" SelectMethod="QueryDatabase"
        TypeName="DBlookup_tableSP">
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="QueryType" Type="Object" />
            <asp:Parameter DefaultValue="RtvVoucherType" Name="Operation" Type="String" />
            <asp:Parameter Name="MAJOR" Type="String" />
            <asp:Parameter Name="MINOR" Type="String" />
            <asp:Parameter Name="DescriptionAr" Type="String" />
            <asp:Parameter Name="DescriptionEn" Type="String" />
            <asp:Parameter Name="OrderID" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
</asp:Content>
